<?php

namespace App\Trip\Plane\Factories;

use App\Trip\Enums\Plane\PlaneProviders;
use App\Trip\Plane\Interfaces\Factories\PlaneQueryFactoryInterface;
use App\Trip\Plane\Interfaces\PlaneQueryInterface;
use App\Trip\Plane\Providers\BookOf51\Book51PlaneQueryAdapter;
use App\Trip\Plane\Providers\Qunar\QunarPlaneQueryAdapter;

/**
 * 供应商航班查询工厂
 */
class PlaneQueryFactory implements PlaneQueryFactoryInterface
{
    public function __construct() { }


    public function Book51Query(): PlaneQueryInterface
    {
        return new Book51PlaneQueryAdapter();
    }

    public function QunarQuery(): PlaneQueryInterface
    {
        return new QunarPlaneQueryAdapter();
    }

    public function findOneByProvider(PlaneProviders $provider): PlaneQueryInterface
    {
        return $provider->getPlaneQueryStrategy();
    }
}